﻿using System.Windows;
using System.Windows.Controls;
using University.Workshop.Presentation.ControlWPF.TransitionControl;
using University.Workshop.Presenters.Square.Modify;

namespace University.Workshop.Presentation.Square.Modify
{
    /// <summary>
    /// Interaction logic for ModifySquareView.xaml
    /// </summary>
    public partial class ModifySquareView : Page, IModifySquareView
    {
        private PresenterModifySquare pModifySquare;
        public ModifySquareView(Model.Square square)
        {
            InitializeComponent();
            pModifySquare=new PresenterModifySquare(this,square);
            pModifySquare.FirstTime();
        }

        private void GoStepOne_Click(object sender, RoutedEventArgs e)
        {
            pModifySquare.GoStepOne();
        }

        private void GoStepTwo_Click(object sender, RoutedEventArgs e)
        {
            pModifySquare.GoStepTwo();
        }

        private void btnUpdateSquare_Click(object sender, RoutedEventArgs e)
        {
            pModifySquare.UpdateSquare();
        }

        private void btnBack_Click(object sender, RoutedEventArgs e)
        {
            pModifySquare.GoBackPage();
        }

        private void btnNext_Click(object sender, RoutedEventArgs e)
        {
            pModifySquare.GoNextPage();
        }

        public void CallSecondPage()
        {
            PageSecondStepModifySquare pp = new PageSecondStepModifySquare(pModifySquare);
            ModifyBasic = pp;

            frmContent.Navigate(pp);
            GoStepTwo.IsEnabled = true;
        }

        public void CallFirstPage()
        {
            PageFirstStepModifySquare pp = new PageFirstStepModifySquare(pModifySquare);
            ModifyBasic = pp;

            frmContent.Navigate(pp);
            GoStepTwo.IsEnabled = true;
        }

        public IModifySquareBasicView ModifyBasic { get; set; }

        public void SystemMessage(string MessageValue)
        {
            MessageBox.Show(App.Current.MainWindow, MessageValue, "Atencion!!!", MessageBoxButton.OK, MessageBoxImage.Information, MessageBoxResult.OK, MessageBoxOptions.RightAlign);
        }

        public void ErrorMessage(string MessageValue)
        {
            MessageBox.Show(App.Current.MainWindow, MessageValue, "Error!!!", MessageBoxButton.OK, MessageBoxImage.Error, MessageBoxResult.OK, MessageBoxOptions.RightAlign);
        }                     



        public void RestartSearchSquare()
        {
            this.NavigationService.Navigate(new SearchSquare());
        }
    }
}
